package vrp;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

@PersistenceCapable
public class Delivery {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;

    @Persistent
    private Key saleOrder;

    @Persistent
    private Key customer;

    @Persistent
    private Key product;

    @Persistent
    private int quantity;

    @Persistent
    private Date date;

    @Persistent
    private int status;

    @Persistent
    private Date createdAt;

    @Persistent
    private Date modifiedAt;

    public Delivery(Key saleOrder, Key customer, Key product, int quantity, Date date) {
    	this.saleOrder = saleOrder;
    	this.customer = customer;
    	this.product = product;
    	this.quantity = quantity;
    	this.date = date;
    	this.status = 0; //0 PROCESSING, 1 FINISHED, 2 CANCELLED
    	this.createdAt = new Date();
    	this.modifiedAt = new Date();
    }

    public Key getKey() {
        return this.key;
    }

    public Key getSaleOrder() {
        return this.saleOrder;
    }

    public Key getCustomer() {
        return this.customer;
    }

    public Key getProduct() {
        return this.product;
    }

    public int getQuantity() {
        return this.quantity;
    }
    
    public Date getDate() {
        return this.date;
    }
    
    public int getStatus() {
        return this.status;
    }

    public Date getCreatedAt() {
        return this.createdAt;
    }

    public Date getModifiedAt() {
        return this.modifiedAt;
    }

    public void setKey(Key someKey) {
    	this.key = someKey;
    }

    public void setSaleOrder(Key saleOrder) {
        this.saleOrder = saleOrder;
    }

    public void setCustomer(Key customer) {
        this.customer = customer;
    }

    public void setProduct(Key product) {
        this.product = product;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }
    
    public void setDate(Date date) {
        this.date = date;
    }    

    public void setStatus(int status) {
        this.status = status;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt= createdAt;
    }

    public void setModifiedAt(Date modifiedAt) {
        this.modifiedAt= modifiedAt;
    }
}